﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
#if (!SILVERLIGHT)
using System.Collections.Concurrent;
#endif

namespace nRoute.Utilities
{
    public static class TypeExtensions
    {
        public static Type[] GetGenericArguments(this Type type)
        {
#if (WINRT)
            return type.GenericTypeArguments;
#else
            return type.GetGenericArguments();
#endif
        }

        public static bool IsAssignableFrom(this Type type, Type assignType)
        {
#if (WINRT)
            return type.GetTypeInfo().IsAssignableFrom(assignType.GetTypeInfo());
#else
            return type.IsAssignableFrom(assignType);
#endif
        }
        
#if (WINRT)
        public static bool IsGenericType(this Type type)
        {
            return type.GetTypeInfo().IsGenericType;
        }
#endif

#if (!WINRT)
        public static Type GetTypeInfo(this Type type)
        {
            return type;
        }
#endif
        
    }
}
